<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type = "text/javascript">
        function checkAll(){
            var hobbies = document.getElementsByName("hobby");
            for(var i = 0;i<hobbies.length;i++){
                hobbies[i].checked = true;
            }
        }

        function checkNo(){
            var hobbies = document.getElementsByName("hobby");
            for(var i = 0;i<hobbies.length;i++){
                hobbies[i].checked = false;
            }
        }

        function checkReverse(){
            var hobbies = document.getElementsByName("hobby");
            for(var i = 0;i<hobbies.length;i++){
                hobbies[i].checked = !hobbies[i].checked;
            }
        }
    </script>
</head>
<body>
    <input type = "checkbox" name = "hobby" value = "cpp"/>C++
    <input type = "checkbox" name = "hobby" value = "jv"/>Java
    <input type = "checkbox" name = "hobby" value = "sj"/>Javascript
    <br/>
    <button onclick = "checkAll()">全选</button>
    <button onclick = "checkNo()">全不选</button>
    <button onclick = "checkReverse()">反选</button>

</body>
</html>